<?php

namespace App\Controller;

use DCarbone\PHPConsulAPI\Catalog\CatalogRegistration;
use DCarbone\PHPConsulAPI\KV\KVPair;
use DCarbone\PHPConsulAPI\QueryOptions;
use DCarbone\PHPConsulAPI\WriteOptions;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use GuzzleHttp\Client as GuzzleClient;
use XiaoZhu\ServiceProxy\AgentProxy;
use DCarbone\PHPConsulAPI\Agent\AgentServiceRegistration;
use XiaoZhu\ServiceProxy\CatalogProxy;
use XiaoZhu\ServiceProxy\Config;
use XiaoZhu\ServiceProxy\KVProxy;

Config::setClient(new GuzzleClient([
    'timeout'  => 2.0,
]));
//Config::setConsulAddress(["172.20.20.10:8500", '172.20.20.11:8500']);
class OrderController extends AbstractController
{
    /**
     * @Route("/order/list", name="srv-order-list")
     * @param Request $request
     *
     * @return JsonResponse
     */
    public function index(Request $request)
    {
        return new JsonResponse(array(
            array('id' => 1, 'name' => '订单1'),
            array('id' => 2, 'name' => '订单2'),
            array('id' => 3, 'name' => '订单3'),
        ), 200);
    }
}
